const ua = navigator.userAgent;
const isIpad = /(iPad).*OS\s([\d_]+)/.test(ua);
const isIPhone = !isIpad && /(iPhone\sOS)\s([\d_]+)/.test(ua);
const isAndroid = /(Android)\s+([\d\.]+)/.test(ua);
const isMobile = isIPhone || isAndroid;
alert(isMobile);
